<?php

namespace App\Http\Middleware;

use Closure;

class Api
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $token = $request->header('token');
        $token || $token = $request->token;

        if($token){
            jwt_decode($request->token);
        }else{
            returnJson('缺少token',-500);
        }
        return $next($request);
    }
}
